import smtplib
from email.mime.text import MIMEText
from email.utils import formataddr

def send_email(mess ,to_addr):
    msg = MIMEText(mess, 'html', 'utf-8') # 构建邮件格式及邮件内容
    msg["From"] = formataddr(("PythonBoy", "13521409066@163.com")) # 邮件发件人信息
    msg["To"] = to_addr # 邮件收件人信息
    msg['Subject']="又是一天，还需努力..." # 邮件的标题


    server = smtplib.SMTP_SSL("smtp.163.com", 994) # 邮件服务器地址
    server.login("13521409066@163.com", "WLRRx4tPvr4pCFty") # 登录代理转发的邮箱
    server.sendmail("13521409066@163.com", to_addr, msg.as_string())  # 自己邮箱/目标邮箱/内容
    server.quit()





def run():
    mail_list=[]
    while True:
        maillist_input = input("请输入邮件地址：")
        if maillist_input == "q":
            break
        else:
            mail_list.append(maillist_input)

    for i in mail_list:
        send_email("PythonBoy",i)


run()

